#Linux： 后面的值为要使用的GPU编号，正常的话是从0开始
export CUDA_VISIBLE_DEVICES=3
# windows: 
# set CUDA_VISIBLE_DEVICES=0

source /mnt/afs2d/luotianhang/basic_set/stop_make_url.sh
export MODEL_NAME='/mnt/afs2d/luotianhang/cache/PretrainedModels/models--diffusers--stable-diffusion-xl-1.0-inpainting-0.1/snapshots/115134f363124c53c7d878647567d04daf26e41e'
export CONTROLNET_NAME=''
export CONTROLNET_FROM_TEXT2IMAGE='/mnt/afs2d/luotianhang/cache/PretrainedModels/models--stabilityai--stable-diffusion-xl-base-1.0/snapshots/462165984030d82259a11f4367a4eed129e94a7b/unet'
# export CONTROLNET_FROM_TEXT2IMAGE='/mnt/afs2d/luotianhang/cache/PretrainedModels/stable-diffusion-v1-5/stable-diffusion-v1-5/unet'
accelerate launch --config_file=./deepspeed_config.yaml train_inpainting2_sdxl.py \
    --pretrained_model_name_or_path=$MODEL_NAME \
    --resolution=512  \
    --train_batch_size=1 --gradient_accumulation_steps=1 --gradient_checkpointing \
    --max_train_steps=250000 \
    --checkpointing_steps=500 \
    --checkpoints_total_limit=2 \
    --learning_rate=1e-05 --max_grad_norm=1 --lr_warmup_steps=0 \
    --seed=423 \
    --output_dir=controlnet_experiment_inpainting \
    --use_8bit_adam   \
    --dataloader_num_workers=0 \
    --variant=fp16 \
    --controlnet_unet=$CONTROLNET_FROM_TEXT2IMAGE

